
#####################################################################
#
# RFID READER SDK FOR PYTHON
# AUTHOR: zengkai001@qq.com
# DATE: 2025-01-24
#
#####################################################################


# The following code is a simple example of how to use the SDK in Python.
from rfid_reader import RFIDReader
rfid = RFIDReader('./x86_64/libGZAE_rfid.so')
rfid.open_device("RDType=RL8000;CommType=USB;AddrMode=0;SerNum=")

info = rfid.get_device_info()
print(f"设备信息: {info}")

rfid.start_inventory()

# Tag UID: e0040150eba27e7f

get_tag_info = rfid.get_tag_info()
print(f"标签信息: {get_tag_info}")

# read_tag(self, uid, block_start, block_count):
tag_data = rfid.read_tag('e0040150eba27e7f', 0, 4)
print(f"标签数据: {tag_data}")


# Write test data to tag
# write_tag(self, uid, block_start, block_count, data):
print("Write data to tag ...")
rfid.write_tag('e0040150eba27e7f', 0, 2, '0000000000000002')

# Read Back
tag_data = rfid.read_tag('e0040150eba27e7f', 0, 4)
print(f"标签数据: {tag_data}")

